package com.zw.admin.server.dao;

import com.zw.admin.server.model.Dict;
import com.zw.admin.server.model.SysChan;
import org.apache.ibatis.annotations.*;

import java.util.List;
import java.util.Map;

@Mapper
public interface SysEquipmentDao {

    @Select("select * from sys_chan t where t.id = #{id}")
    SysChan getById(Long id);

    @Delete("delete from sys_chan where id = #{id}")
    int delete(Long id);

    int update(SysChan sysChan);
    
    @Options(useGeneratedKeys = true, keyProperty = "id")
    @Insert("insert into sys_chan(auth_type, data_format, device_count, gmt_create, node_type, product_key, product_name, update_time, is_delete) values(#{authType}, #{dataFormat}, #{deviceCount}, #{gmtCreate}, #{nodeType}, #{productKey}, #{productName}, #{updateTime}, #{isDelete})")
    int save(SysChan sysChan);
    
    int count(@Param("params") Map<String, Object> params);

    List<SysChan> list(@Param("params") Map<String, Object> params, @Param("offset") Integer offset, @Param("limit") Integer limit);

    @Select("select t.id,t.val from t_dict t where t.type = 'productType' order by t.k")
	List<Dict>  getAllProductType();

    List getAllProductList();
}
